package com.pig.provide.http.service;

import com.pig.rpc.client.IHello1;
import com.pig.rpc.client.dto.Person;
import com.pig.rpc.client.dto.QueryPara;
import com.pig.rpc.client.dto.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.concurrent.ThreadLocalRandom;

/**
 * @author ap
 */
@Service
@Slf4j
public class Hello1 implements IHello1 {
    @Override
    public Result<Person> hello(QueryPara queryPara1, boolean all) {
        String info = "hello " + queryPara1 + "," + all + ",I am " + this.getClass().getName() + ".hello()" + ThreadLocalRandom.current().nextDouble();
        log.info(info);
        Result<Person> result = new Result<>();
        result.setSuccess((byte) 1);
        Person person = new Person();
        person.setName("aaaaaa");
        person.setAge(111);
        result.setObj(person);
        return result;
    }

    @Override
    public String hello(QueryPara queryPara) {
        String result = "hello " + queryPara + ",I am " + this.getClass().getName() + ".hello()" + ThreadLocalRandom.current().nextDouble();
        log.info(result);
        return result;
    }
}
